const rds = require('varal-rds').varal;
const redis = require('../plugins/redis').varal;

const fs = require('fs');
const path = require('path');

module.exports = {
	port: 8888,
	debug: true,

	logPath: 'logs',
	viewPath: 'views',
	staticPath: 'public',
	servicePath: 'services',
	controllerPath: 'controllers',

	weapp: {
		app_id: 'wx233b61b706b5291c',
		app_secret: '52c5de5be53a8e8ede804bcd160d096f'
	},

	wxpay: {
		mch_id: '1648663593',
		/*
		v2，v3 key
		md5('1648663593@@146639')
		*/
		key: '26bab1dac4a1086edad124e156cd39e4',

		public_key: fs.readFileSync(path.join(__dirname, '../public/cert/apiclient_cert.pem')),
		private_key: fs.readFileSync(path.join(__dirname, '../public/cert/apiclient_key.pem'))
	},

	mysql: {
		// host: 'rm-uf6047t535580s383yo.mysql.rds.aliyuncs.com',
		// port: 3306,
		// user: '',
		// password: '',
		// database: 'kachewo_db',
		// pool: true

		host: '47.122.18.111',
		port: 3306,
		user: 'root',
		password: '1314520@tt',
		database: 'kachewo_db',
		pool: true
	},

	redis: {
		host: '',
		port: 6379,
		password: '',
		prefix: 'kachewo_'
	},

	oss: {
		region: '',
		endpoint: '',
		bucket: '',
		accessKeyId: '',
		accessKeySecret: '',
		domain: '',
		maxSize: 100,
		expireTime: 60
	},

	plugins: [
		{
			name: 'app.mysql',
			singleton: true,
			concrete: rds('mysql', 'mysql')
		},
		{
			name: 'app.redis',
			singleton: false,
			concrete: redis()
		}
	]
}
